import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)

export default {
    namespaced: true,
	state: {
		statistics: {
			storageOrderNumber: 0,
			deliverOrderNumber: 0,
			storeWeight: 0,
			waitStorageOrderNumber: 0,
			waitDeliverOrderNumber: 0
		},
		tabbar: [
			{
				iconPath: "home",
				selectedIconPath: "home-fill",
				text: '青猿驿站',
				customIcon: false,
			},
			{
				iconPath: "grid",
				selectedIconPath: "grid-fill",
				text: '业务数据',
				// midButton: true,
				// slotMid: true,
				customIcon: false,
			},
			{
				iconPath: "account",
				selectedIconPath: "account-fill",
				text: '我的',
				customIcon: false,
			},
		],
		goodsDetails: [],
		chooseOrder: {}, //创建出库单时，选择需要合并的出库单对象
	},
	mutations: {
		// 统计
		setCount(state, status){
			state.statistics = status
		},
		// 储存临时选择回收物品列表数据
		setGoodsDetails(state, status){
			state.goodsDetails = status
		},
		//创建出库单时，选择需要合并
		setChooseOrder(state, status){
			state.chooseOrder = status
		}
	},
	actions:{
		// 切换tabbar
		tabChange({
			commit,
			state
		}, e) {
			switch (e) {
				case 0:
					uni.reLaunch({
						url: '/pages/shop/index/index'
					})
					break;
				case 1:
					uni.reLaunch({
						url: '/pages/shop/management/management'
					})
					break;
				case 2:
					uni.reLaunch({
						url: '/pages/shop/my/my'
					})
					break;
			}
		}
	}
}